<?php if(!defined("PATH_HD"))exit;C("SHOW_NOTICE",false);?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title>编辑文章</title>
	<link type="text/css" rel="stylesheet" href="http://localhost/hb/easycms/admin/tpl/public/css/arc.css"/>
	<script type='text/javascript' src='http://localhost/hdphp/plugin/jquery-1.8.2.min.js'></script>
</head>
<body>
	<form action="<?php echo U('save');?>" method="post">
        <input type="hidden" name="aid" value="<?php echo $field['aid'];?>"/>
        <h2 class='arc_tit'>发表文章</h2>
        <div class='arc_setting'>
            <table class="table2">
                <tr>
                    <th width='10%'>标题</th>
                    <td width='88%'>
                        <input type="text" class="input1" name="title" value='<?php echo $field['title'];?>'/>
                        <span class="desc">文章标题不能超过30个字</span>
                    </td>
                </tr>
                <tr>
                    <th>栏目选择</th>
                    <td>
                     	<select name="cid">
                            <option value="选择栏目">选择栏目</option>
                    <?php $hd["list"]["n"]["total"]=0;
if(!empty($category)):
$hd_list_total = count($category);
$hd_list_row = min($hd_list_total,1000);
$hd_list_row = floor($hd_list_row/1);
$hd_list_id=0;
$hd_list_start=1;
$hd_list_step=0;foreach($category as $hd_list_key =>$hd_list_value):
if($hd_list_start<1){$hd_list_start++;continue;}
if($hd_list_step %1!=0){$hd_list_step++;continue;}
$hd_list_step++;$hd["list"]["n"]["first"]=$hd_list_id==0?true:false;
$hd["list"]["n"]["last"]=$hd_list_id>=$hd_list_row-1?true:false;
$hd["list"]["n"]["index"]=$hd_list_id+1;
$n=$hd_list_value;?>

                        <?php if($n['cid'] ==$field['cid']){?>
                            <option value="<?php echo $n['cid'];?>" selected="selected"><?php echo $n['html'];?><?php echo $n['catname'];?></option>
                        <?php  }else{ ?>
                            <option value="<?php echo $n['cid'];?>"><?php echo $n['html'];?><?php echo $n['catname'];?></option>
                        <?php }?>
                    <?php if($hd_list_id+1>=$hd_list_row){break;}
$hd_list_id++;
endforeach;
$hd["list"]["n"]["total"]=$hd_list_id+1;
endif;
?>
                        </select>
                    </td>
                </tr>
                <tr>
                   	<th>关键字</th>
                    <td>
	                    <input type="text" class="input1" name="keywords" value='<?php echo $field['keywords'];?>'/>
	                    <span class="desc">关键字用于搜索引擎优化</span>
                    </td>
                </tr>
                <tr>
                   	<th>缩略图</th>
                    <td>
                    	<link rel="stylesheet" type="text/css" href="http://localhost/hdphp/plugin/uploadify/uploadify.css" />
            <script type="text/javascript" src="http://localhost/hdphp/plugin/uploadify/jquery.uploadify-3.1.js"></script>
            <script type="text/javascript">
            var HDPHP_CONTROL         = "http://localhost/hb/easycms/admin.php/arc";
            var HDPHP_PLUGIN    = "http://localhost/hdphp/plugin";
            var HDPHP_UPLOAD_THUMB    ="";
HDPHP_UPLOAD_TOTAL = 0</script>
            <script type="text/javascript" src="http://localhost/hdphp/plugin/uploadify/hd_uploadify.js"></script>
<script type="text/javascript">
    $(function() {
        hd_uploadify_options.removeTimeout  =0;
        hd_uploadify_options.fileSizeLimit  ="2MB";
        hd_uploadify_options.fileTypeExts   ="*.gif; *.jpg; *.png;*.jpeg";
        hd_uploadify_options.queueID        ="hd_uploadify_thumbimg_queue";
        hd_uploadify_options.showalt        =true;
        hd_uploadify_options.uploadLimit    =6;
        hd_uploadify_options.success_msg    ="正在上传...";//上传成功提示文字
        hd_uploadify_options.formData       ={water : "1", someOtherKey : 1,hdsid:"14m6p5723i8qmlv6nrv146d6i3"};
        hd_uploadify_options.thumb_width          =200;
        hd_uploadify_options.thumb_height          =150;
        hd_uploadify_options.uploadsSuccessNums = 0;

        $("#hd_uploadify_thumbimg").uploadify(hd_uploadify_options);
        });
</script>
<input type="file" name="up" id="hd_uploadify_thumbimg"/>
<div class="hd_uploadify_thumbimg_msg uploadify_upload_msg">
</div>
<div id="hd_uploadify_thumbimg_queue"></div>
<div class="hd_uploadify_thumbimg_files uploadify_upload_files" input_file_id ="hd_uploadify_thumbimg">
    <ul><?php
            $_uploadStr="";//编译文件需要的PHP字符串表示
            $upFileId=0;//第几张图片
            //读取图片数据
            foreach (HdView::$vars["thumbimg"] as $f) {
                $upFileId++;
                $url = 'http://localhost/hb/easycms/' . $f["path"];
        $_uploadStr.="<li><div class='delUploadFile'></div>";
        $_uploadStr.="<img src=" . $url . " path=" . $f["path"] . " width='200px' height='150px'/>";
        //显示图片alt
        if(isset($f["alt"])){
        $_uploadStr.="<div class='upload_title'>
<input type='text'  value='".$f["alt"]."' name='thumbimg[".$upFileId."][alt]'>
</div>";
        }
        //显示原图
                $_uploadStr.="<input t='file' type='hidden' name='thumbimg[".$upFileId."][path]' value='" . $f["path"] . "'/>";
                //缩略图
                if(isset($f["thumb"])){
                    foreach($f["thumb"] as $thumbFile){
                        $_uploadStr.="<input t='file' type='hidden' name='thumbimg[".$upFileId."][thumb][]' value='" . $thumbFile. "'/>";
                    }
                }
                $_uploadStr.="</li>";
            }
        echo $_uploadStr;
        ;
        ?></ul>
    <div style="clear:both;"></div>
</div>
                    </td>
                </tr>
                <tr>
                 	<th>描述</th>
                	<td>
                    	<textarea class="textarea1" name="description"><?php echo $field['description'];?></textarea>
                    </td>
                </tr>
                <tr>
                    <th>内容</th>
                    <td>
                     	<script charset="utf-8" src="http://localhost/hdphp/plugin/keditor/kindeditor-min.js"></script>
            <script charset="utf-8" src="http://localhost/hdphp/plugin/keditor/lang/zh_CN.js"></script>
        <textarea id="hd_content" name="content"><?php echo $field['content'];?></textarea>
	<script>
		var options_content = {
		filterMode : false
                ,id : "editor_id"
		,width : "600px"
		,height:"300px"
                ,formatUploadUrl:false
		,allowFileManager:false
		,allowImageUpload:true
		,uploadJson : "http://localhost/hb/easycms/admin.php/arc&m=keditor_upload&editor_type=2&water=1&uploadsize=2000000&maximagewidth=false&maximageheight=false&hdsid=14m6p5723i8qmlv6nrv146d6i3"//处理上传脚本
		};var hd_content;
		KindEditor.ready(function(K) {
                    hd_content = KindEditor.create("#hd_content",options_content);
		});
		</script>
        
                    </td>
                </tr>
                <tr>
                    <th>点击数</th>
                    <td>
                       	<input type="text" class='input1' name="click" value="<?php echo $field['click'];?>"/>
                    </td>
                </tr>
            </table>
        </div>
        <div class='submit_wrap'>
           	<input type="submit" class="bt1" value="修改"/>
        </div>
    </form>
</body>
</html>